Inside Macintosh: Macintosh Toolbox Essentials

Previous | Chapter Top | Chapter Contents | Next

Filter Function Pointer and Macro

The GetSpecificHighLevelEvent function (GetSpecificHighLevelEvent) takes a universal procedure pointer to an application-defined filter function used to search for a specific event. The Event Manager declares the type for an application-defined specific event filter function as follows:

typedef pascal Boolean (*GetSpecificFilterProcPtr)
                                (void *contextPtr,
                                 HighLevelEventMsgPtr msgBuff,
                                 const TargetID *sender);

For information about writing a specific filter function, see "Filter Function for Searching the High-Level Event Queue" .

The Event Manager defines the universal procedure pointer GetSpecificFilterUPP for an application-defined filter function.

typedef UniversalProcPtr GetSpecificFilterUPP;

The Event Manager also defines the macro NewGetSpecificFilterProc for obtaining a GetSpecificFilterUPP :

#define NewGetSpecificFilterProc(userRoutine)\(GetSpecificFilterUPP)
            NewRoutineDescriptor((ProcPtr)(userRoutine),
            uppGetSpecificFilterProcInfo, GetCurrentArchitecture())

You typically use the NewGetSpecificFilterProc macro like this:

GetSpecificFilterUPP myFilterFunctionProc;
myFilterFunctionProc = NewGetSpecificFilterProc(MyFilter);

The Event Manager also defines the macro CallGetSpecificFilterProc for calling a GetSpecificFilterUPP . You normally don't need to call this macro directly:

#define CallGetSpecificFilterProc(userRoutine, contextPtr,
        msgBuff, sender)\
        CallUniversalProc((UniversalProcPtr)(userRoutine),
        uppGetSpecificFilterProcInfo, (contextPtr), (msgBuff), (sender))

For more information about universal procedure pointers and the Mixed Mode Manager, see Inside Macintosh: PowerPC System Software.


© 1997 Apple Computer, Inc.

Previous | Chapter Top | Chapter Contents | Next